const getTriggerType = (index) =>{
	let dic = [
		{type: '短信触达'},
		{type: 'App 推送触达'},
		{type: 'Webhook 触达'},
		{type: '服务号模板消息'},
		{type: '48小时活跃推送'},
		{type: '公众号群发'},
		{type: 'App 内弹窗'},
		{type: '微信小程序弹窗'},
		{type: 'H5弹窗'},
		{type: '自定义'},
	]
	return dic[index].type
}

function formatNumber(n) {
	n = n.toString();
	return n[1] ? n : '0' + n;
};

function formatDate(date) {
	date = date || new Date()
	const year = date.getFullYear();
	const month = date.getMonth() + 1;
	const day = date.getDate();
	return [year, month, day].map(formatNumber).join('-') 
};

function formatTime(date) {
	date = date || new Date()
	const hour = date.getHours();
	const minute = date.getMinutes();
	const second = date.getSeconds();
	return [hour, minute].map(formatNumber).join(':');
};

export {
	getTriggerType,
	formatNumber,
	formatTime,
	formatDate
}